#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <bitset>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

void solve()
{
	int n;
	cin>>n;
	int sum=0;
	int ans=0;
	int num=0;
	for(int i=n;i>=0;i--)
	{
		sum=0;
		num=0;
		for(int j=1;j<=i;j++)
		{
			sum=sum+j*j;
			num=max(num,j*j);
		}
		int l=i+1;
		int r=n;
		while(l<=r)
		{
			sum=sum+l*r;
			if(l!=r) sum+=l*r;
			num=max(num,l*r);
			l++;
			r--;
		}
		ans=max(ans,sum-num);
	}
	cout<<ans<<endl;
}
int main()
{
	IOS;
	int __t=1;
	cin>>__t;

	while(__t--)
	{
		solve();
	}

	return 0;
}

